#include "../src/parser/sql_parser.h"
#include <stdio.h>
#include <stdlib.h>

// Test standalone SELECT with aliases to isolate the issue
int main() {
    printf("Testing standalone SELECT with aliases\n");
    printf("=====================================\n");
    
    const char* sql = "SELECT name as user_name FROM users";
    printf("Parsing SQL: %s\n", sql);
    
    parser_t* parser = parser_create(sql);
    if (!parser) {
        printf("Failed to create parser\n");
        return 1;
    }
    
    statement_t* stmt = parser_parse_statement(parser);
    
    if (parser_has_error(parser)) {
        printf("Parser error: %s\n", parser_get_error(parser));
    } else if (stmt && stmt->type == STMT_SELECT) {
        printf("Successfully parsed SELECT statement with alias\n");
        statement_destroy(stmt);
    } else {
        printf("Failed to parse SELECT statement\n");
        if (stmt) statement_destroy(stmt);
    }
    
    parser_destroy(parser);
    return 0;
}